# Contributor: Timo Teräs <timo.teras@iki.fi>
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=libvoikko
pkgver=4.3.2
pkgrel=0
pkgdesc="Voikko spelling, hyphenation and grammar checker"
url="https://voikko.puimula.org/"
arch="all"
license="MPL-1.1 GPL-2.0-or-later LGPL-2.1-or-later"
makedepends="foma python3"
options="!check" # test suite is broken
subpackages="$pkgname-dev $pkgname-doc"
source="https://www.puimula.org/voikko-sources/libvoikko/libvoikko-$pkgver.tar.gz"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--disable-static \
		--enable-hfst=false \
		--with-dictionary-path=/usr/share/voikko
	make
}

package() {
	make DESTDIR="$pkgdir" install

	# python bindings
	local sitedir=$(python3 -c "import site; print(site.getsitepackages()[0])")
	mkdir -p "$pkgdir/$sitedir/"
	cp python/libvoikko.py "$pkgdir/$sitedir/libvoikko.py"
}

sha512sums="
d510a9344501f86b2f644c1237faf8709f02b5d17bca76f7934c8422495aeee307f12c60dde47df15a39c24c3311253d3dea2d0648050fc3a056a22497de695c  libvoikko-4.3.2.tar.gz
"
